#ifndef PDAServer_H_
#define PDAServer_H_
#pragma once

#include <RTI/RTI1516.h>
#include <RTI/NullFederateAmbassador.h>
#include "RTICommand.h"
#include "Callback.h"

#include <winsock2.h>
#include <process.h>
#include <ws2tcpip.h>
#include <stdlib.h>

using namespace rti1516;

namespace server {
	class PDAServer
	{
	public:
		static PDAServer* getInstance();
		void sendCallback(Callback* pcb);


		int acceptPDA();
		RTICommand* getCommand();
	private:
		PDAServer(void);
		~PDAServer(void);
		int start();
		int startRTIservices(const char* port);
		int startCallbackServices(const char* port);
	private:
		static PDAServer* m_instance;
		SOCKET ListenSocket, ClientSocket;
		// rti commands are received from this socket
		SOCKET commandSocket, clientCommandSocket;
		// callbacks are sent through this socket
		SOCKET callbackSocket, clientCallbackSocket;

	};
}

#endif